﻿namespace Gardener.Weighbridge.Client.Services
{
    /// <summary>
    /// 地磅控制服务
    /// </summary>
    [ScopedService]
    public class WeighbridgeControlService : ClientServiceCaller, IWeighbridgeControlService
    {
        public WeighbridgeControlService(IApiCaller apiCaller) : base(apiCaller, "weighbridge-control", "weighbridge")
        {
        }

        public Task<bool> Netweight(NetweightCmdInput input)
        {
            return apiCaller.PostAsync<NetweightCmdInput, bool>($"{baseUrl}/netweight", input);
        }

        public Task<bool> ReadValue(ReadValueCmdInput input)
        {
            return apiCaller.PostAsync<ReadValueCmdInput, bool>($"{baseUrl}/read-value", input);
        }
        public Task<bool> SetPrecision(PrecisionCmdInput input)
        {
            return apiCaller.PostAsync<PrecisionCmdInput, bool>($"{baseUrl}/set-precision", input);
        }

        public Task<bool> SetUnit(UnitCmdInput input)
        {
            return apiCaller.PostAsync<UnitCmdInput, bool>($"{baseUrl}/set-unit", input);
        }

        public Task<bool> ZeroOut(CmdInput input)
        {
            return apiCaller.PostAsync<CmdInput, bool>($"{baseUrl}/zero-out", input);
        }
    }
}
